<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>

</body>
<script>

    // 限定符  => 匹配正则表达式中一个给定组件(子表达式)出现多少次才满足条件
    // {n}    匹配前面的子表达式出现n次
    // {n,}   匹配前面的子表达式至少出现n次
    // {n,m}  匹配前面的子表达式至少出现n次,至多m次

    // *      匹配前面的子表达式出现 0次或多次  {0,}
    // +      匹配前面的子表达式出现 1次或多次  {1,}
    // ?      匹配前面的子表达式出现 0次或1次   {0,1}

    // var str = "good good study , daay day up";
    // var reg = /da{2}y/; // daay
    // console.log(reg.test(str));

    // var str = "good good study , daaaaaaaaaaaaaaaaaaay day up";
    // var reg = /da{2,}y/; // daay  daaay daaaay daaaaay  da...y
    // console.log(reg.test(str));

    // var str = "good good study , daaaaay day up";
    // var reg = /da{2,5}y/; // daay  daaay daaaay daaaaay
    // console.log(reg.test(str));

    // var str = "good good study";
    // var reg = /da*y/; // dy day daay  daaay daaaay daaaaay  ...
    // console.log(reg.test(str));

    // var str = "good good study , daaaaay day up";
    // var reg = /da+y/; // day daay  daaay daaaay daaaaay  ...
    // console.log(reg.test(str));

    // var str = "good good study , daaaaay day up";
    // var reg = /da?y/; // dy day
    // console.log(reg.test(str));

    // 一段字符的子表达式
    var str = "good good study , day day up";
    var reg = /(day){2}/; //dayday 
    console.log(reg.test(str));











</script>

</html>